import {ConfigEnv, defineConfig, UserConfig} from 'vite';

import vue from '@vitejs/plugin-vue'
import {resolve} from "path"
import Components from 'unplugin-vue-components/vite'
import {ElementPlusResolver} from 'unplugin-vue-components/resolvers'
// https://vitejs.dev/config/
export default defineConfig(({mode}: ConfigEnv): UserConfig => {
    return {
        plugins: [
            vue(),
            Components({
                resolvers: [ElementPlusResolver()],
            }),
        ],
        resolve: {
            alias: {
                '@': resolve(__dirname, './src'),
            },
        },
        server: {
            port: 3000,
            strictPort: true,
            host: "0.0.0.0",
            proxy: {
                '/api/v1': {
                    target: 'http://localhost:8080/',
                    changeOrigin: true,
                    ws: true,
                }
            },

        },
        build: {
            outDir: '../back/web/static/'
        },
    }
});
